import filetool from '../tool/file-tool'
import constant from '../../common/global-constant'

export default {
  saveDbConnectionInfo: (connectionInfo) => {
    filetool.fileWrite(constant.CONNECTION_FILE_DIR, `${constant.CONNECTION_FILE_PRE}${connectionInfo.name}${constant.CONNECTION_FILE_END}`, JSON.stringify(connectionInfo))
    return true
  },
  getDbConnectionList: () => {
    let fileList = filetool.getFileByPath(constant.CONNECTION_FILE_DIR)
    return fileList
  },
  rmDbConnectionInfo: (path) => {
    filetool.fileRemove(path)
  }
}
